home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / cuj0696.zip / DWYER.ZIP / SPECTRAL.TST / SPECTRAL.DOC < prev    next >
Text File  |  1996-01-26  |  6KB  |  184 lines

  1.  
  2.           Description of Program Spectral         January 26, 1996
  3.  
  4.  
  5.     INTRODUCTION
  6.  
  7.     The purpose of program spectral is to check the quality of multi-
  8.     plier and modulus of linear congruential random number generators.
  9.     One-parameter and two-parameter generators can be handled.
  10.  
  11.     Program spectral implements Knuth's Algorithm S (The Spectral
  12.     Test) [1, pp. 89-113].  The underlying theory is described on
  13.     pages 89-98 of [1].  The algorithm implemented is described on
  14.     pages 98-105.  The generalization described in exercise 24, page
  15.     113 of [1] has also been implemented.
  16.  
  17.     Program spectral employs software written by Steve Moshier [2] to
  18.     do 100-digit extended precision arithmetic.
  19.  
  20.     This document describes how to use program spectral.
  21.  
  22.  
  23.     HOW TO USE PROGRAM SPECTRAL
  24.  
  25.     Program spectral resides on disk as spectral.exe.  Standard units
  26.     are used for input and output:
  27.  
  28.         stderr  - Prompts for inputs and and error messages
  29.         stdin   - Input data
  30.         stdout  - Results
  31.  
  32.     Start program spectral by issuing the command
  33.  
  34.         spectral
  35.  
  36.     at the command line.
  37.  
  38.     My favorite input technique is to prepare an input file with the
  39.     required data, one item per line.  Then the redirect the input
  40.     unit with:
  41.  
  42.         sepctral < [file name]
  43.  
  44.     If you decide to enter the data directly, you will be prompted for
  45.     input data as follows:
  46.  
  47.         How Many Multipliers? [1 or 2]:
  48.         Enter Multiplier:
  49.         Enter Modulus:
  50.         Enter Maximum Dimension:
  51.  
  52.     The text shown is produced when you respond '1' to the first
  53.     prompt. You must enter either 1 or 2.  If you don't, program
  54.     spectral issues a warning message and asks you to reenter the
  55.     input:
  56.  
  57.         How Many Multipliers? [1 or 2]: 3
  58.         Incorrect Response: 3
  59.  
  60.  
  61.                                - 1 -
  62.  
  63.           Description of Program Spectral         January 26, 1996
  64.  
  65.  
  66.         How Many Multipliers? [1 or 2]:
  67.  
  68.     The following prompts are produced when you respond '2' to the
  69.     first prompt:
  70.  
  71.         How Many Multipliers? [1 or 2]: 2
  72.         Enter First  Multiplier:
  73.         Enter Second Multiplier:
  74.         Enter Modulus:
  75.         Enter Maximum Dimension:
  76.  
  77.     For example, to replicate the numbers on line 27, page 102 of [1]
  78.     your responses must be:
  79.  
  80.         How Many Multipliers? [1 or 2]: 1
  81.         Enter Multiplier:               314159269
  82.         Enter Modulus:                  2147483647
  83.         Enter Maximum Dimension:        6
  84.  
  85.     The only two-parameter generator illustrated in [1] is given on
  86.     line 28. Here is what your responses must be:
  87.  
  88.         How Many Multipliers? [1 or 2]: 2
  89.         Enter First  Multiplier:        271828183
  90.         Enter Second Multiplier:        -314159269
  91.         Enter Modulus:                  2147483647
  92.         Enter Maximum Dimension:        6
  93.  
  94.     A requirement of the Spectral Test is that the multiplier(s) and
  95.     the modulus be relatively prime. When this is not the case, you
  96.     will be advised with a printout like the following:
  97.  
  98.         Multiplier and modulus not relatively prime.
  99.         GCD of Multiplier and Modulus =  xxxx
  100.         Error(s) detected in input data
  101.  
  102.     The minimum dimension that is tested is 2. If you enter something
  103.     less than that your input is silently ignored.
  104.  
  105.  
  106.     OUTPUT FROM PROGRAM SPECTRAL
  107.  
  108.     Standard Printouts
  109.     ------------------
  110.  
  111.     The first few lines of output echo your inputs. Thereafter, the
  112.     results of the Spectral Test are printed - two lines per dimension
  113.     requested.  For example, when the test cited above for line 27
  114.     from [1] is run, the following output is produced:
  115.  
  116.                 1                    Number of Multipliers
  117.                 314159269            Multiplier
  118.                 2147483647           Modulus
  119.                 6                    Maximum Dimension of Test
  120.  
  121.  
  122.                                - 2 -
  123.  
  124.           Description of Program Spectral         January 26, 1996
  125.  
  126.  
  127.     2-Dimensional Accuracy =  1432232969  No. Bits:  15.2
  128.     2-Dimensional Merit    =  2.10        (Good > 0.1, Great > 1.0)
  129.     3-Dimensional Accuracy =  899290      No. Bits:  9.9
  130.     3-Dimensional Merit    =  1.66        (Good > 0.1, Great > 1.0)
  131.     4-Dimensional Accuracy =  36985       No. Bits:  7.6
  132.     4-Dimensional Merit    =  3.14        (Good > 0.1, Great > 1.0)
  133.     5-Dimensional Accuracy =  3427        No. Bits:  5.9
  134.     5-Dimensional Merit    =  1.69        (Good > 0.1, Great > 1.0)
  135.     6-Dimensional Accuracy =  1144        No. Bits:  5.1
  136.     6-Dimensional Merit    =  3.60        (Good > 0.1, Great > 1.0)
  137.  
  138.     The numbers that you see in this example exactly replicate those
  139.     given in [1].  The output you see here has been cropped to fit on
  140.     the page.
  141.  
  142.     Error Printouts
  143.     ---------------
  144.  
  145.     As stated previously, you must enter 1 or 2 to the first prompt.
  146.     Failure to do so can result is severe mental anguish, to wit:
  147.  
  148.         How Many Multipliers? [1 or 2]: 3 <-- Uncalled for
  149.         Incorrect Response: 3
  150.         How Many Multipliers? [1 or 2]:
  151.  
  152.     It is a requirement that the multiplier(s) under test and the
  153.     modulus be relatively prime.  When this is not the case, you are
  154.     shown the error of your ways as follows:
  155.  
  156.         How Many Multipliers? [1 or 2]: 1
  157.         Enter Multiplier:               314159269
  158.         Enter Modulus:                  2147483639
  159.         Multiplier and modulus not relatively prime.
  160.         GCD of Multiplier and Modulus =  17
  161.         Error(s) detected in input data
  162.  
  163.     REFERENCES
  164.  
  165.     1. Donald E. Knuth, The Art of Computer Programming, Second
  166.     Edition, Vol. 2, Seminumerical Algorithms, Addison-Wesley,
  167.     Reading, Mass. (1981).
  168.  
  169.     2. Steven L. Moshier, Methods and Programs for Mathematical
  170.     Functions, Prentice-Hall (1989)
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.                                - 3 -
  184.